//
//  FileUtil.m
//  LOU
//
//  Created by iMacOne on 15/11/10.
//  Copyright © 2015年 UNOHACHA. All rights reserved.
//

#import "FileUtil.h"

@implementation FileUtil
#pragma mark 寻找项目根目录中的文件，返回物理路径
+ (NSString*) projectPath:(NSString*)fileName {
    return [[NSBundle mainBundle] pathForResource:fileName ofType:nil];
}

#pragma mark 寻找文档目录中的文件，返回物理路径
+ (NSString*) documentPath:(NSString*)fileName {
    NSArray *dirPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    return [[NSString alloc] initWithString: [dirPaths[0] stringByAppendingPathComponent: fileName]];
}

#pragma mark 删除文件
+ (void)delFile:(NSString*)path {
    NSFileManager *manager = [NSFileManager defaultManager];
    if ([manager fileExistsAtPath:path]) {
        [manager removeItemAtPath:path error:nil];
    }
}

@end
